package com.lyf.scm.plan.domain.remote.bigdata.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

/**
 * 多维度查询接口-返回结果DTO
 * @author wuyuanhang
 * @date 2020/11/5
 */
@Data
public class OlapQueryResultDTO {

    @ApiModelProperty("列")
    private List<Map<String, String>> columnList;

    @ApiModelProperty("值")
    private List<List<Object>> rows;

    public enum  OlapGroupColumnEnum {
        /**
         * 渠道
         */
        CHANNEL("channel", "CHANNEL_SOURCE", "渠道"),
        /**
         * 省
         */
        PROVINCE("province", "RECEIVER_PROVINCE_CODE", "省"),
        /**
         * 市
         */
        CITY("city", "RECEIVER_CITY_CODE", "市"),
        /**
         * 区
         */
        COUNTY("county", "RECEIVER_COUNTY_CODE", "区"),
        /**
         * 大品类
         */
        CATEGORY_2("category2", "CATEGORY_TWO_CODE", "大品类"),
        /**
         * 中品类
         */
        CATEGORY_3("category3", "CATEGORY_THREE_CODE", "中品类"),
        /**
         * 小品类
         */
        CATEGORY_4("category4", "CATEGORY_FOUR_CODE", "小品类"),
        /**
         * sku
         */
        SKU_KEY("sku_key", "SKU_KEY", "sku"),
        /**
         * 日期
         */
        WEEK("week", "DATE_KEY", "日期"),
        /**
         * 门店
         */
        NODE_ID("node_id", "STORE_KEY", "门店");

        private String plan;
        private String olap;
        private String desc;

        OlapGroupColumnEnum(String plan, String olap, String desc) {
            this.olap = olap;
            this.plan = plan;
            this.desc = desc;
        }

        public String getOlapCode() {
            return olap;
        }
        public String getPlanCode() {
            return plan;
        }
    }

    public static void main(String args[]) {
        String str = "2020-11-10";
        LocalDate parse = LocalDate.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        LocalDate with = parse.with(DayOfWeek.MONDAY);
        System.out.println(with);
    }
}
